<h2>Pembagian Tugas Mengajar Guru - Tahun Ajaran <?echo $school_year . $semester?></h2>
<?php echo form_open("admin/teachings") ?>
<ul class="fields">
	<fieldset>
		<legend>Kata Kunci Pencarian</legend>
		<li>
			<?php echo my_form_radio(array('name'=>'search_by', 'label'=>'Filter Pencarian :', 'default'=>!empty($search_by)?$search_by:'nip', 
				'options' => array(
					array('value'=>'nip', 'label'=>'NIP'), 
					array('value'=>'name', 'label'=>'Nama')
				)
			)) ?>
		</li>
		<li>
			<?php echo my_form_input(array('name'=>'keyword', 'label'=>'Kata Kunci :', 'default'=>'', 'properties'=>'id="keyword" size="30" class="form_field"')) ?>
			<div class="actions">
				<?php echo form_submit('update', 'Cari', 'id="submit"') ?>
				&nbsp;&nbsp;&nbsp;
				<?php echo form_reset('reset', 'Reset', 'id="reset"') ?>
			</div>
		</li>
		<li class="prerequisites">
			<?php echo "Pencarian menghasilkan " . $total_rows . " data."?>
		</li>
	</fieldset>
</ul>
<?php echo form_close() ?>

<?php if (isset($info) && !empty($info)) : ?>
	<?php echo info_box($info,50) ?>
<?php elseif (isset($error) && !empty($error)) : ?>
	<?php echo error_box($error,50) ?>
<?php endif ?>

<?php if (count($teachers) > 0) : ?>
<? echo ! empty($pagination) ? '<p id="pagination">' . $pagination . '</p>' : '';?>

<table class="list" width="100%">
<thead>
<tr>
	<th width="5%">No</th>
	<th width="5%"><?php echo sort_link("admin/teachings/index/$offset/nip","NIP")?></th>
	<th width="20%"><?php echo sort_link("admin/teachings/index/$offset/name","Nama")?></th>
	<th>Bidang Studi</th>
</tr>
</thead>
<tbody>
<?php
	$num = $offset+1;
	foreach ($teachers as $t) {
		$trclass = ($num % 2 == 0) ? 'zebra' : ''; 
?>
<tr class="<?php echo $trclass ?>">
	<td class="rownum"><?php echo $num ?></td>
	<td><?php echo $t['nip'] ?></td>
	<td><?php echo show_link('admin/teachings/add/'.$t['id'], $t['name']) ?></td>
	<td><?php 
		$teachings = $this->teachings->lists($school_year_id, $t['id']);
		if(count($teachings)==0)
			echo "-";
		else
		foreach($teachings as $teach){
			$subject = $this->subjects->get($teach['subject_id']);
			$amount = $this->teachings->count($school_year_id, $t['id'],$subject['id']);
			echo show_link('admin/teachings/add/'.$t['id']."/".$teach['subject_id'],$subject['name']."(".$amount.")") . " ";
		}
		?>
	</td>
<?php 
		$num += 1;
	}
?>
</tr>
</tbody>
</table>
<ul class="prerequisites"> 
	<li>Klik pada nama guru untuk menambah / mengubah / menghapus data bidang studi untuk guru bersangkutan.</li>
	<li>Klik pada nama bidang studi untuk menambah data kelas yang diajar guru yang bersangkutan.</li>
	<li>Angka dalam kurung setelah nama mata pelajaran menunjukkan jumlah kelas yang diajar untuk mata pelajaran dan guru bersangkutan</li>
</ul>
<? echo ! empty($pagination) ? '<p id="pagination">' . $pagination . '</p>' : '';?>
<?php else : ?>
	<p class="message">Belum ada data</p>
<?php endif ?>

